@Jerome_Donfack There are two main requirements to use transformer in SwiftData:
The type returned by transformedValueClass needs to correspond to the type you declare in the model, so it needs to be changed to NSArray.self
transformedValue can only be encoded as NSData, and in CoreData, we can encode into any supported type, such as NSNumber, NSString
Override class func transformedValueClass() -> AnyClass {
Return NSArray.self // change to NSArray
}
BTW: If it is not to be compatible with your other custom data, SwiftData will use the built-in transaformer to encode [String] without using transformable
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: